/*!
 * ---------------------------------------------------------------------
 *
 * GLPI - Gestionnaire Libre de Parc Informatique
 *
 * http://glpi-project.org
 *
 * @copyright 2015-2025 Teclib' and contributors.
 * @copyright 2003-2014 by the INDEPNET Development Team.
 * @licence   https://www.gnu.org/licenses/gpl-3.0.html
 *
 * ---------------------------------------------------------------------
 *
 * LICENSE
 *
 * This file is part of GLPI.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 *
 * ---------------------------------------------------------------------
 */

html:not([data-glpi-theme-dark="1"]) {
    .netport {
        --glpi-cotrunk-bg: silver;
        --glpi-hub-bg: lightsalmon;
        --glpi-trunk-bg: mediumaquamarine;
        --glpi-aggregated-bg: darkturquoise;
        --glpi-network-color: var(--tblr-dark);
    }
}

html[data-glpi-theme-dark="1"] {
    .netport {
        --glpi-cotrunk-bg: dimgray;
        --glpi-hub-bg: indianred;
        --glpi-trunk-bg: seagreen;
        --glpi-aggregated-bg: teal;
        --glpi-network-color: white;

        a {
            color: white;
        }
    }
}

.netport {
    &:target {
        animation: shakeX; // from animate css dependencies
        animation-duration: 2s;
        scroll-margin-top: 5em;
    }

    td {
        &.green {
            background-color: green;
            color: white;
        }

        &.red {
            background-color: red;
            color: white;
        }

        &.orange {
            background-color: orange;
            color: white;
        }
    }

    &.trunk {
        background-color: var(--glpi-trunk-bg);
        color: var(--glpi-network-color);
    }

    &.hub {
        background-color: var(--glpi-hub-bg);
        color: var(--glpi-network-color);
    }

    &.cotrunk {
        background-color: var(--glpi-cotrunk-bg);
        color: var(--glpi-network-color);
    }

    &.aggregated,
    .aggregated {
        background-color: var(--glpi-aggregated-bg);
        color: var(--glpi-network-color);
        padding-left: 2em;
    }

    .hub {
        border: 1px grey solid;
        margin: 0 0.5em;

        div {
            padding: 0.2em 0.5em;
            border-bottom: 1px grey solid;

            &:last-of-type {
                border-bottom: none;
            }
        }
    }
}

.netport-legend {
    width: 100%;
    color: var(--tblr-dark);

    td.netport {
        text-align: center;
        width: 25%;
    }

    @if var($is-dark) {
        color: white;
    }
}
